<?PHP
$PurviewLevel=0;
require("../../inc/common.inc.php");
require_once(dirname(__FILE__)."/../"."Admin_ChkPurview.php");
if(intval($pagetype)==0){$pagetype=2;}
$poststr = "&type=".$type."&pagetype=".$pagetype."&keyword=".$keyword."&rid=".$rid."&cid=".$cid;
$poststr2 = "&pagetype=".$pagetype."&rid=".$rid."&cid=".$cid;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="../images/style.css" rel="stylesheet" type="text/css" />
<script>
var P = window.parent, D = P.loadinndlg();   // 注意！这行代码是每个内容页必须加的内容，否则无法正确显示。
</script>
</head>

<body style="background:#FFF;">
<?php
if($action=="post"){
	if(intval($checkid)==0){
		echo '<script>alert("请先选择图文消息");history.go(-1);</script>';
		exit;
	}else{
		$sucaiinfo = $db->getinfo("select * from mx_sucai_msg where mid='".$checkid."' limit 1");
		if($sucaiinfo){
			echo '<script>window.top.main.showinfo("'.$returnid.'","'.$changeid.'","'.$checkid.'");P.cancel();</script>';
			exit;
		}else{
			echo '<script>alert("参数错误");history.go(-1);</script>';
			exit;
		}
	}
}
?>
<div class="xm2_b">
			<div class="t">
				<div style=" float:right; padding:5px; padding-right:10px; font-weight:bold;">快速检索: <input name="keyword" type="text" value="<?php echo $keyword;?>" onkeydown="setTrack(this,event)" /></div>
				<div class="clear"></div>
			</div>
				<script type="text/javascript" src="../js/jquerys-1.5.1.js"></script>
                <script language="javascript">
				function setTrack(tt,event){
				var e = event?event:window.event
				if(e.keyCode == 13){
				window.location="tuisong_msg_list.php?type=title<?php echo $poststr2;?>&keyword="+tt.value;
				}
				}
				</script>
				<script language="javascript">
				$(document).ready(function(){ //这个就是传说的ready   
				$(".stripe tr").mouseover(function(){   
				//如果鼠标移到class为stripe的表格的tr上时，执行函数   
				$(this).addClass("over");}).mouseout(function(){   
				//给这行添加class值为over，并且当鼠标一出该行时执行函数   
				$(this).removeClass("over");}) //移除该行的class   
				$(".stripe tr:even").addClass("alt");   
				//给class为stripe的表格的偶数行添加class值为alt
				//www.divcss5.com 整理特效
				});   
				function selectradio(radioid){
					document.getElementById("checkid"+radioid).checked="checked";
				}
				function checkselete(){
					var itemradio = document.getElementsByName("checkid"); 
					var itemvalue = ''; 
					 for(i=0;i<itemradio.length;i++){
						if(itemradio[i].checked){   
						 itemvalue = itemradio[i].value; 
						}
					 }
					 if( itemvalue =="" ){
					  alert('请先选择图文消息');
					  return false;
					 }
				}
				function returnselect(selectid){
					document.getElementById("checkid").value=selectid;
					document.form1.submit();
				}
				</script> 
                
               <form name="form1" action="tuisong_msg_list.php?action=post<?php echo $poststr;?>" method="post" onsubmit="return checkselete()">
               <input type="hidden" name="returnid" value="<?php echo $rid;?>">
               <input type="hidden" name="changeid" value="<?php echo $cid;?>"> 
              <input type="hidden" name="checkid" id="checkid" value="0"> 
			<div class="imglist11">
              <?php
			  if(empty($pageindex)){$pageindex=1;}
			  $str=" and fid=0";
			  if($type=="yz"){
				  $str.=" AND isok=1 ";
			  }
			  elseif($type=="unyz"){
				  $str.=" AND isok=0 ";
			  }
			  elseif($type=="title"){
				  $str.=" AND mtitle LIKE '%$keyword%' ";
			  }
			  $order="order by addtime desc, mid desc";
			  $pagesize = $pagetype==1?"10":"5";
			  $table=" mx_sucai_msg ";
			  $column=" * ";
			  $c=$db->listcount($table,$str);
			  $list=$db->list1($pageindex,$pagesize,$table,$column,$str,$order);
			  if(!is_array($list) or $c==0){
				echo "<tr><td colspan='10'><p style='height:30px;text-align:center;line-height:30px;'>暂无信息</p></td></tr>";
			  }
			  else{
			  for($i=0;$i<count($list);$i++){
				  $mtypestr="";
				  if($list[$i]["fid"]==0&&$list[$i]["mtype"]==1){$mtypestr='&nbsp;&nbsp;<a href="sucai_text_adds.php?fid='.$list[$i]["mid"].'">增加一条</a>';}
				  //获得封面图片
				  $mpic = $db->getinfo("select fpath from mx_sucai_file where fid = ".$list[$i]["mpic"]." limit 1");
				  //获得多图文的下属图文消息、
				  $smsg = array();
				  if($list[$i]["mtype"]==1){
					  $smsgquery = $db->excu("select * from mx_sucai_msg where fid=".$list[$i]["mid"]." order by addtime,mid");
					  
					  while($smsgarr = $db->fetch_array($smsgquery)){
						  $smsg[] = $smsgarr;
					  }
				  }
			  ?>
			  
              <div class="imgitem" style="cursor:pointer;" onclick="returnselect(<?php echo $list[$i]["mid"]?>)">
                	<div class="imgitemtop"></div>
                    <div class="imgitembod">
                    	<div class="imgitembod-img"><img src="<?php echo get_photourl($mpic["fpath"])?>" width="300" height="211" /></div>
                        <div class="imgitembod-txt">
                            <h1><?php echo wordscut($list[$i]["mtitle"],50,"...")?></h1>
                            <span><?php echo date("Y/m/d",$list[$i]["addtime"])?></span>
                        </div>
                        
                    </div>
                    <div class="imgitembot"></div>
                </div>
			  
			  <?php
			  }
			  }
			  ?>
              <div class="clear"></div>
			</div>
            
			<div class="height15"></div>
			<div class="pagination">
				<?php if ($c>$pagesize){echo $db->ThePage_mxsoft($s,$pageindex,$c,$pagesize,'','',0,4,''.$poststr.'');}?>
			</div>
            <div class="clear"></div>
			<div class="height15"></div>
            </form>
		</div>
</body>
</html>